package br.com.dbsti.agenda;

import br.com.winesys.geta.annotations.Columns;
import br.com.winesys.geta.annotations.TableColumn;
import br.com.winesys.geta.annotations.TableModel;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PersistenceUnit;

@Entity
@PersistenceUnit(name = "agenda")
@NamedQueries({
    @NamedQuery(name = "Contato.listCRUD", query = "from Contato order by empresa.nome, nome")
})
@TableModel({
    @TableColumn(field = "codigo", width = 20),
    @TableColumn(field = "nome", width = 30),
    @TableColumn(field = "telefone", width = 20)
})
public class Contato implements Serializable {

    @Id
    private Long codigo;
    @ManyToOne()
    @JoinColumn(name = "empresa")
    private Empresa empresa;
    private String nome;
    @Columns(12)
    private String telefone;

    public Long getCodigo() {
        return codigo;
    }

    public void setCodigo(Long codigo) {
        this.codigo = codigo;
    }

    public Empresa getEmpresa() {
        return empresa;
    }

    public void setEmpresa(Empresa empresa) {
        this.empresa = empresa;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }
    
}
